import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;

import cn.edu.zju.om.nlp.SUWordSegmentorAdapter;
import cn.edu.zju.om.nlp.WordSegmentor;


/** This is a very simple demo of calling the Chinese Word Segmenter 
 *  programmatically.  It assumes an input file in UTF8.
 *  <p/>
 *  <code>
 *  Usage: java -mx1g -cp seg.jar SegDemo fileName
 *  </code>
 *  This will run correctly in the distribution home directory.  To
 *  run in general, the properties for where to find dictionaries or 
 *  normalizations have to be set.
 *
 *  @author Christopher Manning
 */

public class SegDemo {

  public static void main(String[] args) throws Exception {
//    /*if (args.length != 1) {
//      System.err.println("usage: java -mx1g SegDemo filename");
//      return;
//    }*/
//
//    Properties props = new Properties();
//    props.setProperty("sighanCorporaDict", "data");
//    // props.setProperty("NormalizationTable", "data/norm.simp.utf8");
//    // props.setProperty("normTableEncoding", "UTF-8");
//    // below is needed because CTBSegDocumentIteratorFactory accesses it
//    props.setProperty("serDictionary","data/dict-chris6.ser.gz");
//    //props.setProperty("testFile", "test");
//    props.setProperty("inputEncoding", "UTF-8");
//    props.setProperty("sighanPostProcessing", "true");
//    
//    CRFClassifier classifier = new CRFClassifier(props);
//    classifier.loadClassifierNoExceptions("data/ctb.gz", props);
//    // flags must be re-set after data is loaded
//    classifier.flags.setProperties(props);
//    //classifier.writeAnswers(classifier.test(args[0]));
//    //classifier.testAndWriteAnswers(args[0]);
	  
	  WordSegmentor segmentor = new SUWordSegmentorAdapter();
	  
	  while (true) {
		  
		  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); 
		  
		  String input = reader.readLine();

		  
		  List<String> list = segmentor.segment(input);
		  
		  for(String str : list) {
		    	System.out.print(str + " ");
		    }
		  
	  }

  }

}
